package cn.edu.njpi.utils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zzh
 */
public class T implements Serializable {
    private int status;
    private Map<Object,Object> data;
//    private List<Object> list;


    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Map<Object, Object> getData() {
        return data;
    }

    public void setData(Map<Object, Object> data) {
        this.data = data;
    }

    public void add(String a,Object o){
        this.data.put(a,o);
    }

    public void add(Object o){
        List<Object> list = (List<Object>) this.data.get("list");
        this.data.remove("list");
        list.add(o);
        this.data.put("list",list);
    }

    public void sedList(Object o){
        List<Object> list = (List<Object>) this.data.get("list");
        this.data.remove("list");
        this.data.put("list",o);
    }
    public T() {
        this.data=new HashMap<>();
        this.data.put("list",new ArrayList<>());
//        this.list= new ArrayList<>();
    }

    public T(int status, Map<Object, Object> data) {
        this.status = status;
        this.data = data;
    }

    @Override
    public String toString() {
        return "T{" +
                "status=" + status +
                ", data=" + data +
                '}';
    }
}
